<template>
  <el-button
    class="filter-item"
    :size="size"
    :type="type"
    :plain="plain"
    :round="round"
    :circle="circle"
    :loading="loading"
    :disabled="disabled"
    :icon="icon"
    :autofocus="autofocus"
    :event-type="eventType"
    @click.stop="emit"
  >
    {{ $t('button.'+eventType) }}
  </el-button>
</template>
<script>
/*
    通用按钮组件
*/
export default {
  name: 'Button',
  props: {
    size: { // 按钮尺寸 默认medium
      type: String,
      default: 'medium'
    },
    type: { // 按钮类型
      type: String
    },
    plain: { // 是否朴素按钮
      type: Boolean,
      default: false
    },
    round: { // 是否圆角按钮
      type: Boolean,
      default: false
    },
    circle: { // 是否圆形按钮
      type: Boolean,
      default: false
    },
    loading: { // 是否加载中状态
      type: Boolean,
      default: false
    },
    disabled: { // 是否禁用状态
      type: Boolean,
      default: false
    },
    icon: { // 图标 默认即无图标
      type: String
    },
    autofocus: { //  是否默认聚焦
      type: Boolean,
      default: false
    },
    eventType: { // 按钮事件 必须属性
      type: String,
      required: true
    }
  },
  data() {
    return {}
  },
  methods: {
    emit() {
      this.$emit(this.eventType)
    }
  }
}
</script>

<style scoped>

</style>
